﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using zichan.BLL;

namespace zichan.Controllers
{
    public class StatisticsController : BaseController
    {
        // GET: AssetStatistics
        public ActionResult AssetIndex(int? assetClassId,int? serverPurposeId,int? companyId,DateTime? sdt,DateTime? edt)
        {
            ViewBag.assetClassId = assetClassId;
            ViewBag.assetClassIds = new SelectList(AsseteClassService.GetAsseteClassList(string.Empty, string.Empty), "Id", "Name");
            ViewBag.companyId = companyId;
            ViewBag.companyIds = new SelectList(CompanyClassService.GetCompanyList(), "Id", "Name", ViewBag.companyId);
            ViewBag.serverPurposeId = serverPurposeId;
            ViewBag.serverPurposeIds = new SelectList(ServerPurposeService.GetList(), "serverPurposeId", "serverPurposeName", ViewBag.serverPurposeId);
            ViewBag.sdt = sdt;
            if (sdt.HasValue)
                ViewBag.sdt = sdt.Value.ToShortDateString();
            ViewBag.edt = edt;
            if (edt.HasValue)
                ViewBag.edt = edt.Value.ToShortDateString();
            return View(StatisticsService.AssetStatisticsList(assetClassId,serverPurposeId,companyId,sdt,edt));
        }
        public ActionResult IpStatistics(int? machineRoomId)
        {
            ViewBag.machineRoomId = machineRoomId;
            ViewBag.machineRoomIds = new SelectList(MachineRoomService.List(), "Id", "Name");
            return View(StatisticsService.IpStatisticsList(machineRoomId));
        }
        public ActionResult CabinetIndex(int? machineRoomId)
        {
            ViewBag.machineRoomId = machineRoomId;
            ViewBag.machineRoomIds = new SelectList(MachineRoomService.List(), "Id", "Name");
            return View(StatisticsService.CabinetStatisticsList(machineRoomId));
        }
    }
}